<template>
  <div class="index"></div>
</template>

<script>
const { ipcRenderer } = window.require('electron')

export default {
  name: 'Index',
  mounted() {
    let status = ipcRenderer.sendSync('check-status')

    console.log(status)

    axios.get('https://wiki.biligame.com/wiki/api.php', {
      params: {
        action: 'query',
        meta: 'tokens',
        format: 'json'
      }
    })
      .then((response) => {
        let csrftoken = response.data.query.tokens.csrftoken

        if (csrftoken !== '+\\') {
          this.$router.push({ name: 'Home' })
        }

        else {
          this.$router.push({ name: 'LoginIndex' })
        }
      })
      .catch((error) => {
        console.log(error)
      })
  },
}
</script>

<style lang="scss" scoped>
.index {
  height: 100vh;
}
</style>